<?php
class calendar_data extends data 
{
	public function getCalendarEvents($fromdate, $todate)
	{
		$this->query("SELECT e.eventid as id,  e.eventname as title,  FROM_UNIXTIME(e.startdate, '%e-%c-%Y') as date,  FROM_UNIXTIME(e.startdate, '%k:%i') as time FROM event e WHERE e.startdate > '$fromdate' and e.startdate < '$todate'");
		if($this->num_rows())
			return $this->fetch_all_row();
		else 
			return null;
	}
	
	public function getCalendarTooltipEvent()
	{
		$this->query("SELECT e.eventid as id,  e.eventname, i.istancename, e.startdate, e.enddate, e.duedate,  e.onlymain, e.onlyprimaryspec  FROM event e, istance i WHERE e.istanceid = i.istanceid  and e.eventid = '{$_REQUEST['eventid']}'");
		return $this->fetch_array();
	}
	
	public function getCalendarPlayeronEvent()
	{
		$this->query("SELECT s.pgid, p.pgname FROM pg p, signup s WHERE s.userid = {$_SESSION['userid']} AND eventid = {$_REQUEST['eventid']} AND p.pgid = s.pgid");
		return $this->fetch_combo_all_row();
	}
	
}
?>